<?php
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가 

$url = '';
if ($g4['https_url']) {
    if (preg_match("/^\./", $urlencode))
        $url = $g4[url];
    else
        $url = $g4[url].$urlencode;
} else {
    $url = $urlencode;
}
?>
<tr>
    <td>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
                        <tbody><tr>
                          <td><table width="100%" cellspacing="0" cellpadding="0" border="0">
                              <tbody><tr>
                                <td><img width="104" height="16" src="images/home_tag_time.gif"/></td>
                                <td><div align="right"><a href="<?=$g4['bbs_path']?>/logout.php"><img width="34" height="16" src="images/home_buttom_out.gif"/></a></div></td>
                              </tr>
                          </tbody></table></td>
                        </tr>
                        <tr>
                          <td><table width="100%" cellspacing="0" cellpadding="3" border="0" class="font">
                              <tbody><tr>
<?php
    $year = date('Y');
    $month = date('m');
    $wod = strtolower(date('D'));
    $sql = "SELECT m2.mb_name as tname, c.starttime FROM course_order o, course c, g4_member m, g4_member m2 WHERE o.student = m.mb_no AND o.course = c.no AND m2.mb_no = c.teacher AND m.mb_id = '{$_SESSION['ss_mb_id']}' AND c.year = $year AND c.month = $month AND w_$wod = 1 AND o.status = 2 GROUP BY c.no";
    $res = mysql_query($sql);

    $sql = "SELECT count(1) FROM course_order o, g4_member m, course c WHERE o.student = m.mb_no AND m.mb_id = '{$_SESSION['ss_mb_id']}' AND c.no = o.course AND c.month = $month AND c.year = $year AND o.status = 2";
    list($count) = mysql_fetch_row(mysql_query($sql));

    $data = array();
    while($temp = mysql_fetch_assoc($res)) {
        $data[] = $temp;
    }

    if(count($data)> 0) :
        foreach($data as $val) :
?>
<td width="130" height="18"><a class="style4" target="_self" href="#"><?php echo $val['tname']?></a></td>
                                <td><div align="right">
<?php if($val['starttime'] == date('H')) :?>
<img width="23" height="13" src="images/home_tag_on.gif"/>
<?php else: ?>
<img width="23" height="13" src="images/home_tag_off.gif"/>
<?php endif; ?>

</div></td>
                              </tr>

<?php
        endforeach;

    else :

?>
                              <tr>
                                <td width="130" height="36" colspan="2"><div align="center">
                                    오늘은 강의가 없습니다
                                </div></td>
                              </tr>
<?php
    endif;
?>
                          </tbody></table></td>
                        </tr>
                      </tbody></table>
</td></tr>
<tr><td>
<div align="center"><a target="_self" href="/mydesk/timetable.php">My desk</a> <span class="style2">|</span> <a target="_self" href="#">이번달 수업 : <?php echo $count?>개</a></div>
</td></tr>
<!-- 
<tr>
                      <td>
                      <table width="100%" cellspacing="0" cellpadding="0" border="0">
                          <tbody><tr>
                            <td><table width="100%" cellspacing="0" cellpadding="0" border="0">
                                <tbody><tr>
                                    <td></td>
                                </tr>
                            </tbody></table></td>
                            <td width="66"><div align="justify"><a href="<?#=$g4['bbs_path']?>/logout.php"><input type="image" style="width:52px; height:35px;" src="images/home_login_button.gif" /></a></div></td>
                          </tr>
                      </tbody></table>
                       
<input type="hidden" name="url" value='<?#=$url?>'>
                      </form></td>
                    </tr>
<tr>
                      <td height="23"><a href="./register.php">회원가입</a> <span class="style2">|</span> <a href="javascript:;" onclick="win_password_forget('./password_forget.php');">아이디/비밀번호 찾기</a></td>
                    </tr>
-->
